<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="./js/vue.js"></script>
    <div id="app">
        <h3>复选框单独使用时：</h3>
        <!--v-model绑定单选框单独使用时，绑定的是布尔值，多个复选框使用时，绑定的是一个数组-->
        <input id="picked" type="checkbox" v-model="text">
        <label for="picked">{{text}}</label>

        <h3>复选框多个使用时：</h3>
        <!-- <input id="jack" type="checkbox" value="jack" v-model="checkedNames">
        <label for="jack">Jack</label>
        <input id="John" type="checkbox" value="John" v-model="checkedNames">
        <label for="John">John</label>
        <input id="Mike" type="checkbox" value="Mike" v-model="checkedNames">
        <label for="Mike">Mike</label>
        <p>Checked names:{{checkedNames}}</p> -->
        <div class="heng">
            <div v-for="item,index in hobbies" >
                <input :id="item" type="checkbox" :value="item" v-model="checkedNames">
                <label :for="item">{{item}}</label>
            </div>
        </div>
        <p>Checked names:{{checkedNames}}</p>
    </div>
    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                text: false,
                checkedNames: [],
                hobbies: ['篮球', '排球', '足球', '乒乓球', '台球']
            }
        })
    </script>
</body>
<style>
    .heng {
        display: flex;
    }
</style>

</html>